#ifndef GAMEMANAGER_H
#define GAMEMANAGER_H

#include "Game.h"
#include "ParametersBean.h"
#include "Tank.h"
#include "Bullet.h"
#include "Command.h"
#include "GameBoard.h"
#include "Dynamicobject.h"
#include "Cell.h"
#include <QVector>
#include <QSharedPointer>
#include <QDateTime>

class GameManager : QObject
{
    Q_OBJECT

public:
    GameManager();

    virtual void GameLoop() = 0;
    virtual bool IsServer() const = 0;

public slots:

    // Client -> Server (Instance is server)
    virtual void SlotProcessRequest(CommandPtr request) = 0;

    // Server -> Client (Instance is client)
    virtual void SlotPlayerList(PlayerlistBean* playerlist_bean) = 0;
    virtual void SlotMap(MapBean* map_bean) = 0;
    virtual void SlotSnapshot(SnapshotBean* snapshot_bean) = 0;

protected:
    GamePtr m_game;
    qint64 m_lastUpdate; // QDateTime::currentMSecsSinceEpoch()

    unsigned calcObjectPosition(DynamicObject* object, double elapsed);
};

#endif // GAMEMANAGER_H
